#include <iostream>
#include<string>
#include<set>
#include<unordered_map>
#include<vector>
using namespace std;

typedef pair<string, int> PII;
struct cmp
{
    bool operator()(const PII& p1, const PII& p2) const
    {
        if (p1.second == p2.second)
        {
            return p1.first < p2.first;
        }
        return p1.second > p2.second;
    }
};
vector<string> v;
set<PII, cmp> mp;
unordered_map<string, int> c;
int main() {
    int a, b;
    string s;
    while (cin >> s)
    {
        for (int i = 0;i < s.size();i++)
        {
            if (s[i] >= 'A'&&s[i]<'a') s[i] += ('a' - 'A');
            if(s[i]=='.') s.erase(i);
        }
        v.push_back(s);
        c[s]++;
    }
    for (auto e : v)
    {
        PII p(e, c[e]);
        mp.insert(p);
    }
    for(auto& e:mp)
    {
        cout << e.first << ":" << e.second << endl;
    }
}
// 64 位输出请用 printf("%lld")